import axios from "axios";

const request = axios.create({
  baseURL: "",
  timeout: 5000,
});

request.interceptors.request.use((config) => {
  const token = localStorage.getItem("token");
  if (token) {
    config.headers.Authorization = `Bearer ${token}`;
  }
  return config;
}, (e) => Promise.reject(e))

request.interceptors.response.use((res) => res.data, (e) => Promise.reject(e))

export default request;
